<?php
class Bid_Service extends BidService{
    static function countBid($service_id){
        $countBidService = BidService::model()->countByAttributes(array('service_id'=>$service_id));
        return $countBidService;
    }
    
    static function getNameService($service_id){
        $name = Service::model()->findByPk($service_id);
        return $name->name;
    }
    
    static function getName($user_id){
        $name = Users::model()->findByPk($user_id);
        return $name->name;
    }
    static function getMoney($service_id){
        $money = Service::model()->findByPk($service_id);
        $m = number_format($money->money,0, ',', '.');
        return $m;
    }
    
    static function getDateComplete($service_id){
        $date = Service::model()->findByPk($service_id);
        return $date->completiondate;  		
    }
    static function getDeposited($bid_id){
        $deposited = BidService::model()->findByPk($bid_id);
        $ok = "Đã đặt cọc";
        $no = "Chưa đặt cọc";
        if($deposited->bid_deposited == 1){
            return $ok;
        }else if($deposited->bid_deposited == 0){
            return $no;
        }
    }
    
    static function getComplete($bid_id){
        $deposited = BidService::model()->findByPk($bid_id);
        $ok = "Đã kết thúc";
        $no = "Chưa kết thúc";
        if($deposited->bid_completed == 1){
            return $ok;
        }else if($deposited->bid_completed == 0){
            return $no;
        }
    }
}
?>